//#include<stdio.h>
//#include<unistd.h>
//#include<sys/types.h>
//int main(){
//    printf("pid:%d\n",getpid());
//    printf("ppid:%d\n",getppid());
//    return 0;
//}
//通过系统调用显示进程标识符

//#include<stdio.h>
//#include<unistd.h>
//#include<sys/types.h>
//int main(){
//    printf("目前的进程id:%d,父进程id:%d\n",getpid(),getppid());
//    int ret = fork();
//    printf("目前的进程id:%d,父进程id:%d\n",getpid(),getppid());
//    return 0;
//}
//子进程调用

#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
int main(){
    int ret =fork();
    if(ret == -1){
        printf("进程创建失败\n");
    }
    else if(ret == 0){
        printf("I am child,my id is %d,my father's id is %d\n",getpid(),getppid());
    }
    else if(ret > 0){
        printf("I am father,my id is %d,my child's id is %d\n",getpid(),ret);
    }
    return 0;
}
//fork()返回值演示
